package comxxxx.service;

import comxxxx.fallback.ProductServiceFallblack;
import comxxxx.pojo.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author zzuli_huahua
 * @version 1.0
 * @date 2022/1/25 13:07
 */
// 声明需要调用的服务
@FeignClient(value = "product-service", fallbackFactory = ProductServiceFallblack.class)
public interface ProductService {
    /**
     * 查询商品列表
     * @return
     */
    @GetMapping("/product/list")
    List<Product> selectProductList();

    /**
     * 根据多个主键查询商品
     * @param ids
     * @return
     */
    @GetMapping("/product/listByIds")
    List<Product> selectProductListByIds(@RequestParam("id") List<Integer> ids);

    /**
     * 根据主键查询商品
     * @param ids
     * @return
     */
    @GetMapping("/product/{id}")
    Product selectProductListById(@PathVariable("id") Integer ids);
}
